home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
dev
/
c
/
cweb31p9d.lha
/
CWeb
/
examples
/
readme
< prev
next >
Wrap
Text File
|
1994-07-09
|
4KB
|
76 lines
This directory contains several files for programs that are tutorial
and/or useful. If you are new to CWEB, read "wc.w" first; it's a
typical example of CWEB applied to system programming.
The MAKEFILE.ORG in this directory is a generic way to build applications
written in CWEB. The MAKEFILE in this directory is a complete example
makefile for the SAS/C compiler on the Commodore Amiga, written by
Andreas Scherer. Say, for example, "smake all" to get all the executable
programs from their sources. Say "smake docs" to get a printable listing
of their documentations.
The WC program is a slight improvement over UNIX's standard word-count
utility. To use it, say "make wc" to get an executable program "wc"
from wc.w. Say "make wc.dvi" to get a printable listing of its documentation.
The TREEPRINT program, by Norman Ramsey, generates tree-structured
representations of file hierarchies. To use it, say "make treeprint"
and then
find dir -type p -print | sort | treeprint
(on a UNIX system), where dir is a directory with interesting subdirectories.
The files XVIEW_TYPES.W and XLIB_TYPES.W are examples of @i (include) files
that can be used when writing XView programs. They are based on the header
files in OpenWindows Version 3.0.
An examples XVIEW application appears in Knuth's program OEMACS.W, which
he uses for heavy emacsing. It's not very portable, but if you have
OpenWindows3 and a Sun Type-4 keyboard you may like it as much as he does.
(It replaces "emacstool".) The file OEMACS.EL goes with it.
The EXTEX and WORDTEST programs, by Don Knuth, are useful spellcheckers.
After "make extex" say also "ln extex excweb"; this gives
you two filter programs, extex and excweb, that remove extraneous
material from TeX and CWEB source files, respectively. To use them,
you can say for example
cat foo.w | excweb | spell
(or replace "cat foo.w" with "wmerge foo.w bar.ch"). A similar pipeline
for TeX files would be
cat foo.tex | extex | spell
Even better is to replace "spell" by "wordtest /usr/local/lib/dict/words",
if you have a suitable dictionary. One such dictionary in the public domain
can be found in directory ~ftp/pub/dict at labrea.stanford.edu, available
via anonymous ftp. To make your own dictionary from given ones,
cat dict1 dict2 dict3 dict4 | wordtest > words
is quick and effective. See the documentation of wordtest for more info.
A file KSPELL.EL that provides an emacs user interface to extex+excweb+wordtest
also appears in this directory. (Somebody should write ELWEB...)
All the CWEB example programs listed above are provided with change files
for full ANSI-C compliance (prototypes, #include files, etc.), so they
should be compilable with any decent C compiler, although they may not be
operational on every machine.
The COMMONWORDS program, by Andreas Scherer, is based on the WEB program of
the same name by Don Knuth. It counts the frequencies of the most common
words in a given text file. To use it, say "make commonwords" and then
"commonwords < commonwords.w".
The PRIMES program, by Andreas Scherer, is based on the WEB program of the
same name by Don Knuth. It generates the first thousand prime numbers.
To use it, say "make primes" and then simply "primes".
The SAMPLE program, by Andreas Scherer, is based on the WEB program of the
same name by Don Knuth. It generates samples of random numbers. To use
it, say "make sample" and then simply "sample". Answer the input questions
with positive integers and see the results.
The MATRIX program, by Andreas Scherer, is an example for C++ programming
with CWEB 3. Also it is an example for German users; the complete source
is written with umlauts and quotes as defined in `gcwebmac.tex'. Its
purpose is to invert 4x4 matrices with elements from the complex set.
The CCT program, by Andreas Scherer, copies `text files' between different
systems and translates the character codes according to external tables.